package com.gjy.util.reflect;

import java.lang.reflect.Field;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-12-05 15:16:14
 */
public class ObjectUtil {

    public static <T> Object get(T t, String field) {
        Class<?> cls = t.getClass();
        try {
            Field f = cls.getDeclaredField(field);
            f.setAccessible(true);
            return f.get(t);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
